import http from "@/utils/request";


interface IlistItemData{
  
    proname:string,
    proid:string,
    imgs:Array<string>
    category:string
    desc:string
    issale:string
  
}

interface IResproListData{
  code:string
  message:string
  data:Array<IlistItemData>
}
function proListRequest(count=1,limitNum=10,search="",category=""){
  return http<IResproListData>({
    method:'get',
    url:"/admin/pro/list",
    params: {count,limitNum,search,category},
  })
}


//删除
interface IResproDelData{
  code:string
  message:string
  data:{
    token:string
    adminname:string
  }
}
function proDelRequest(proid:string){
  return http<IResproDelData>({
    method:'delete',
    url:"/admin/pro/product/" + proid,
    data: {proid},
  })
}

//修改
interface IResproUpdateData{
  code:string
  message:string
  data:{
    token:string
    adminname:string
  }
}
function proUpdateRequest(proid:string,obj:object){
  return http<IResproUpdateData>({
    method:'patch',
    url:"/admin/pro/product/" + proid,
    data: obj
  })
}

//发布
interface IResproUpdateData{
  code:string
  message:string
  data:{
    token:string
    adminname:string
  }
}
function proSendRequest(proid:string,obj:object){
  return http<IResproUpdateData>({
    method:'post',
    url:"/admin/pro/product/" + proid,
    data: obj
  })
}
export {proListRequest,proDelRequest,proUpdateRequest,proSendRequest}